import { IsNotEmpty, IsOptional, IsString, Length } from 'class-validator';
import { Exclude } from 'class-transformer';
export class AuthDto {
  @IsString()
  @IsNotEmpty()
  @Length(5, 20, {
    // '$value':当前用户传递的值
    //   '$proprty':当前用户传递的属性
    //   $targt:当前类
    //    $constraint1:最小长度
    message: '用户名最小长度为$constraint1和$constraint2之间',
  })
  username: string;

  @IsString()
  @IsNotEmpty()
  @Length(5, 20)
  password: string;

  @IsOptional()
  roles?: string[];
}
